require 'drb/drb'
require 'signal'
class Plugin
	include DRb::DRbUndumped
        include Signaling

	def initialize(coreURI,name)
		@name=name
		DRb.start_service
		puts "connecting to: "+coreURI
		@core=DRbObject.new(nil,coreURI)
		puts "registering.."
		@core.register(self)
	end

	def selfKill
		#@core.unreg(self)
		@core=nil
		Thread.new{
			sleep 1
			DRb.stop_service
			Process.exit
		}
	end
	
	def pid
		return Process.pid
	end

	attr_reader :name

end
